/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tablasBD;

import java.io.Serializable;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author user w7 64 ulti
 */
@Entity
@Table(name = "pago")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Pago.findAll", query = "SELECT p FROM Pago p"),
    @NamedQuery(name = "Pago.findByTipo", query = "SELECT p FROM Pago p WHERE p.pagoPK.tipo = :tipo"),
    @NamedQuery(name = "Pago.findByMonto", query = "SELECT p FROM Pago p WHERE p.pagoPK.monto = :monto"),
    @NamedQuery(name = "Pago.findByIdFactura", query = "SELECT p FROM Pago p WHERE p.pagoPK.idFactura = :idFactura"),
    @NamedQuery(name = "Pago.findByNumeroTarjeta", query = "SELECT p FROM Pago p WHERE p.numeroTarjeta = :numeroTarjeta"),
    @NamedQuery(name = "Pago.findByFranquicia", query = "SELECT p FROM Pago p WHERE p.franquicia = :franquicia"),
    @NamedQuery(name = "Pago.findByBanco", query = "SELECT p FROM Pago p WHERE p.banco = :banco"),
    @NamedQuery(name = "Pago.findByNumeroCuotas", query = "SELECT p FROM Pago p WHERE p.numeroCuotas = :numeroCuotas"),
    @NamedQuery(name = "Pago.findByNumeroAprobacion", query = "SELECT p FROM Pago p WHERE p.numeroAprobacion = :numeroAprobacion")})
public class Pago implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected PagoPK pagoPK;
    @Column(name = "numero_tarjeta")
    private String numeroTarjeta;
    @Column(name = "franquicia")
    private String franquicia;
    @Column(name = "banco")
    private String banco;
    @Column(name = "numero_cuotas")
    private String numeroCuotas;
    @Column(name = "numero_aprobacion")
    private String numeroAprobacion;
    @JoinColumn(name = "id_factura", referencedColumnName = "id", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Factura factura;

    public Pago() {
    }

    public Pago(PagoPK pagoPK) {
        this.pagoPK = pagoPK;
    }

    public Pago(String tipo, int monto, String idFactura) {
        this.pagoPK = new PagoPK(tipo, monto, idFactura);
    }

    public PagoPK getPagoPK() {
        return pagoPK;
    }

    public void setPagoPK(PagoPK pagoPK) {
        this.pagoPK = pagoPK;
    }

    public String getNumeroTarjeta() {
        return numeroTarjeta;
    }

    public void setNumeroTarjeta(String numeroTarjeta) {
        this.numeroTarjeta = numeroTarjeta;
    }

    public String getFranquicia() {
        return franquicia;
    }

    public void setFranquicia(String franquicia) {
        this.franquicia = franquicia;
    }

    public String getBanco() {
        return banco;
    }

    public void setBanco(String banco) {
        this.banco = banco;
    }

    public String getNumeroCuotas() {
        return numeroCuotas;
    }

    public void setNumeroCuotas(String numeroCuotas) {
        this.numeroCuotas = numeroCuotas;
    }

    public String getNumeroAprobacion() {
        return numeroAprobacion;
    }

    public void setNumeroAprobacion(String numeroAprobacion) {
        this.numeroAprobacion = numeroAprobacion;
    }

    public Factura getFactura() {
        return factura;
    }

    public void setFactura(Factura factura) {
        this.factura = factura;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (pagoPK != null ? pagoPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Pago)) {
            return false;
        }
        Pago other = (Pago) object;
        if ((this.pagoPK == null && other.pagoPK != null) || (this.pagoPK != null && !this.pagoPK.equals(other.pagoPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "servidor.reportes.Pago[ pagoPK=" + pagoPK + " ]";
    }
    
}
